package com.gitee.wsl.io.dataproxy

interface DataProxy<T> : DataGet<T>, DataSet<T> {

    fun fill(value: T, fromIndex: Int = 0, toIndex: Int = size)

    fun update(block:(value:T)->T) = indexes.forEach { i->
        val t = this[i]
        this[i] = block(t)
    }

    fun updateIndexed(block:(index:Int,value:T)->T) = indexes.forEachIndexed { index, i ->
        val t = this[i]
        this[i] = block(i,t)
    }

    //override fun iterator(): MutableIterator<T>
}

interface DataProxyContainer<T>: DataGetContainer<T> {
    override val proxy: DataProxy<T>
    companion object
}

